package logger

import (
	"log/slog"
	"os"
	"server/pkg/utils"
	"server/version"
)

var Logger = slog.Default()

func Init() error {
	h := &OTelHandler{Handler: slog.NewJSONHandler(os.Stdout, nil)}
	Logger = slog.New(h).
		With("server_name", version.ServerName).
		With("server_ip", utils.GetLocalIP()).
		With("server_version", version.Version).
		With("hostname", utils.GetHostName()).
		WithGroup("extra")
	Logger.Info("logger initialized")
	return nil
}
